package com.example.activitytest;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.Toast;

public class NormalActivity extends BaseActivity {

    private static final String TAG = "NormalActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_normal);
        Log.d(TAG, "onCreate: Task id is " + getTaskId());

        //定义一个退出程序的按钮
        Button kill_button = (Button) findViewById(R.id.kill_button);
        kill_button.setOnClickListener(view -> {
            ActivityCollector.finishAll();
        });

        //如果接收到ThirdActivity传入的password，则弹出toast
        Intent intent = getIntent();
        String passWord = intent.getStringExtra("pass_word");
        if(passWord != null){
            Toast.makeText(this, passWord, Toast.LENGTH_SHORT).show();
        }
    }
}